import { defineStore } from "pinia"; // 定义容器
import { ref, computed } from 'vue';

//  示例 - 推荐写法
export const useCounterStore = defineStore('counter', () => {
  //  data
  const count = ref(0)

  //  computed
  const doubleCount = computed(() => count.value * 2)

  //  methods
  function increment() {
    count.value++
  }

  return { count, doubleCount, increment }
})